package com.eastfair.home.service.impl;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.dto.ReportSpaceAuditDTO;
import com.eastfair.home.service.HomeReportSpaceMustPayOrderService;
import com.eastfair.venuebooking.api.ReportSpaceMustPayOrderFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 主场报馆必缴订单服务
 *
 * @author dqq
 * @date 2023 /6/9
 */
@Service
@Slf4j
public class HomeReportSpaceMustPayOrderServiceImpl implements HomeReportSpaceMustPayOrderService {

    @Resource
    private ReportSpaceMustPayOrderFeign reportSpaceMustPayOrderFeign;

    @Override
    public boolean saveMustPayOrder(ReportSpaceAuditDTO reportSpaceAuditDTO) {
        log.info("saveMustPayOrder - 搭建商报馆审核通过生成必缴订单, reportSpaceAuditDTO={}", reportSpaceAuditDTO);
        R<Boolean> result = reportSpaceMustPayOrderFeign.saveMustPayOrder(reportSpaceAuditDTO);
        log.info("saveMustPayOrder - 搭建商报馆审核通过生成必缴订单, result={}", result);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}